package com.battle.service.controller.web;

import com.battle.pojo.param.tacticsUser.*;
import com.battle.pojo.vo.tacticsUser.*;
import com.battle.service.service.in.*;
import nirvana.core.domains.vo.PageResult;
import nirvana.core.domains.vo.ApiResult;
import org.springframework.web.bind.annotation.*;

import jakarta.validation.Valid;

import java.util.List;

/**
*   web/战术学习
* 【描 述】：
* 【环 境】：J2SE
* 【详 细】：
*
*/
@RestController
@RequestMapping("/tacticsUser/web")
public class TacticsUserWebController {

private final TacticsUserService service;

public TacticsUserWebController(TacticsUserService service) {
this.service = service;
}


/**
* 创建战术学习
* @param param
* @return
*/
@PostMapping("/createTacticsUser")
public ApiResult createTacticsUser(@RequestBody @Valid CreateTacticsUserParam param){
service.createTacticsUser(param);
return ApiResult.ok();
}


/**
* 修改战术学习
* @param param
*/
@PutMapping("/editTacticsUser")
public ApiResult editTacticsUser(@RequestBody @Valid EditTacticsUserParam param){
service.editTacticsUser(param);
return ApiResult.ok();
}

/**
* 移除战术学习
* @param id
*/
@DeleteMapping("/removeTacticsUser")
public ApiResult removeTacticsUser(@RequestParam("id") Long id){
service.removeTacticsUser(id);
return ApiResult.ok();
}

/**
* 启动/禁用战术学习
* @param id
*/
@GetMapping("/enabledTacticsUser")
public ApiResult enabledTacticsUser(@RequestParam("id") Long id){
service.enabledTacticsUser(id);
return ApiResult.ok();
}

/**
* 获取战术学习详情
* @param id
* @return
*/
@GetMapping("/getTacticsUser")
public ApiResult< GetTacticsUserVo> getTacticsUser(@RequestParam("id") Long id){
GetTacticsUserVo vo = service.getTacticsUser(id);
return ApiResult.ok(vo);
}

/**
* 获取战术学习列表
* @param param
* @return
*/
@PostMapping("/getTacticsUserList")
public ApiResult< PageResult< GetTacticsUserListVo>> getTacticsUserList(@RequestBody GetTacticsUserListParam param){
PageResult< GetTacticsUserListVo> result = service.getTacticsUserList(param);
return ApiResult.ok(result);
}


/**
* 获取战术学习下拉列表
*
* @return
*/
@PostMapping("/getTacticsUserDownList")
public ApiResult< List< GetTacticsUserDownListVo > > getTacticsUserDownList(@RequestBody(required = false) @Valid GetTacticsUserDownListParam param) {
List< GetTacticsUserDownListVo > list = service.getTacticsUserDownList(param);
return ApiResult.ok(list);
}


}

